//
//  WDGoutApplyCancelRescueViewModel.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/8/14.
//

#import "WDGoutApplyCancelRescueViewModel.h"

@implementation WDGoutApplyCancelRescueViewModel
- (void)initialize {
    [super initialize];
    self.title = @"申请取消救援";
    
    _cancelApplyReqModel = [WDRescueCancelGrabApplyReqModel new];
    _cancelApplyReqModel.engineerId = @([EDSAppDelegateTool sharedInstance].userInfoModel.id);
    _cancelApplyReqModel.stationId = @([EDSAppDelegateTool sharedInstance].userInfoModel.stationId);
}

- (void)setupData {
    _cancelApplyReqModel.taskId = @(self.serviceModel.id);
}

/// 取消外出救援申请
/// - Parameter completion: completion description
- (void)requestWithCancelGrabApply:(RequestCompletionBlock)completion {
    @weakify(self);
    WDRescueCancelGrabApplyRequest *request = [[WDRescueCancelGrabApplyRequest alloc] initWithModel:self.cancelApplyReqModel];
    [request startWithCompletionBlockWithSuccess:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        [self sendResponseObject:request.responseModelObject completion:completion];
    } failure:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        [self sendResponseObject:request.responseModelObject completion:completion];
    }];
}

@end
